extends VBoxContainer

@onready var length: Label = $Control/Length
@onready var arrow: TextureRect = $Control/Length/Arrow

var current_scene : Node2D

func _ready() -> void:
	current_scene = get_tree().current_scene

func _process(delta: float) -> void:
	var ball = current_scene.ball
	var current_cole = current_scene.current_cole
	if not current_cole : return
	var len = ball.to_local(current_cole.global_position).length()
	length.text = "洞口距离 "+str(roundi(len / 50))+" M"
	
	var camera = current_scene.camera
	var dir = ball.to_local(current_cole.global_position)
	var rad_rot = atan2(dir.y,dir.x)
	arrow.rotation_degrees = rad_to_deg(rad_rot)
